import { configureStore } from "@reduxjs/toolkit"
import { useSelector } from "react-redux/es/hooks/useSelector"
import type { TypedUseSelectorHook } from "react-redux/es/types"
import countStore from "./modules/count"
import layoutStore from "./modules/layout"
import menusStore from "./modules/menus"
import userStore from "./modules/user"
const store = configureStore({
	reducer: {
		countStore,
		layoutStore,
		menusStore,
		userStore,
	},
})
// 拿到getState返回值的ts类型
export type RootState = ReturnType<typeof store.getState>
// 通过泛型接口传递给useAppSelector函数
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
export default store
